<include file="public@header" />
<style>
	/*.controls{ color:#999}*/
	/*.minwidth{width:45px !important}*/
	/*div[name='d_gaiban'],div[name='d_al']{ width:100%;float:left;}*/
	/*.form-horizontal .control-group1{}*/

	.form-group{ color:#999}
	.minwidth{width:70px !important}

	.w70{
		width:  80px !important;}
	.w100{
		width: 100px !important;
	}
	.inputw ,.w80{
		width: 80px !important;
	}
	.w160{
		width: 140px !important;
	}

	.marleft {
		margin-left: 90px !important;
	}
	.w80{
		width: 80px!important;
	}

	.w180{
		width: 180px !important;
	}
	input{
		width: 100%;
	}

</style>
</head>
<body>
<php> </php>
<div class="wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('visua/index')}">{:lang('ADMIN_VISUA_INDEX')}</a></li>
		<li class="active"><a href="">{:lang('ADMIN_TOMBAREA_PRODUCT')}</a></li>
	</ul>
	<form method="post" class="form-horizontal js-ajax-form" action="{:url('visua/productadd_post')}" >
		<div class="row">
			<div class="p_title" style="margin: -9px 0 10px 0px;">
				<span class="span_title">墓位信息</span>
			</div>
			<div class="col-lg-10 control-group1-p" style="margin: 0 0 0 15px; padding: 15px 0 0 0;width: 85%;">
				<div  class="form-group" >
					<label class="control-label">状态：</label>
					<div class="col-md-2">
						<select class="form-control" name="pro_status" disabled>
							<option value="1">启用</option>
						</select>
					</div>
					<label class="control-label w100">墓位编号：</label>
					<div class="col-md-7">
						<input type="text" disabled  style="width: 100%" class="form-control"  value="{$num_sn}" >
					</div>
				</div>

				<!--<if condition="$cate_id eq 1"> 商品葬-->
				<fieldset>
					<div class="form-group" >
						<label class="control-label">葬式：</label>
						<div class="col-md-2">
							<select class="form-control" name="funeral" disabled >
								<foreach name="tomb_funeral.sp" item="vo">
									<if condition="isset($result['funeral'])">
										<option value="{$vo}" <if condition="$vo eq  $result['funeral'] ">selected </if>>{$vo}</option>
										<else />
										<option value="{$vo}" >{$vo}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100" >占地长度：</label>
						<div class="col-md-2" style="width: 12%">
							<input type="text" class="form-control  "  disabled  name="footprint"  style="width: 80%"  value="{$result.footprint|default=''}" >mm
						</div>
						<label class="control-label w100" >占地宽度：</label>
						<div class="col-md-2" style="width: 21%">
							<input type="text" class="form-control w180"  disabled  name="tombstone_w"  value="{$result.tombstone_w|default=''}" >mm
						</div>
						<label class="control-label w100" >墓碑高度：</label>
						<div class="col-md-2">
							<input type="text" class="form-control w180"  disabled  name="tombstone_h" value="{$result.tombstone_h|default=''}" >mm
						</div>
					</div>
					<div class="form-group"  >
						<label class="control-label">墓穴规制：</label>
						<div class="col-md-2">
							<select class="form-control" name="tomb_regulation" disabled >
								<foreach name="tomb_regulation" item="vo">
									<if condition="isset($result['tomb_regulation'])">
										<option value="{$vo.id}" <if condition="$vo.id eq  $result['tomb_regulation'] ">selected </if>>{$vo.name}</option>
										<else />
										<option value="{$vo.id}" >{$vo.name}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100"  >收敛形式：</label>
						<div class="col-md-2" style="width: 12%">
							<select class="form-control" name="convergence" disabled >
								<foreach name="tomb_convergence.sp" item="vo">
									<if condition="isset($result['convergence']) ">
										<option value="{$vo}" <if condition="$vo eq  $result['convergence'] ">selected </if>>{$vo}</option>
										<else />
										<option value="{$vo}" >{$vo}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100" >单穴最大尺寸：</label>
						<div class="col-md-2" style="width: 21%">
							<input type="text" class="form-control" disabled value="{$result.sc_width|default='0'}*{$result.sc_height|default='0'}*{$result.sc_thick|default='1'}" style="width: 130px;" > mm
						</div>
						<label class="control-label w100">拜道规格：</label>
						<div class="col-md-2">
							<input type="text" class="form-control w180" disabled name="specifications"  value="{$result.specifications|default='10*10'}" > mm
						</div>
					</div>
					<div class="form-group" >
						<label class="control-label ">绿化带规格：</label>
						<div class="col-md-2"  >
							<input type="text" class="form-control w180" disabled name="green_belt"    placeholder="长*宽" value="{$result.green_belt|default='10*10'}" > mm
						</div>
						<label class="control-label w100">绿化带数量：</label>
						<div class="col-md-2" style="width: 12%">
							<input type="text" class="form-control" disabled name="greenbelt_num" placeholder="数量" value="{$result.greenbelt_num|default='1'}" >
						</div>
						<label class="control-label w100" >售后质保期：</label>
						<div class="col-md-2" style="width: 21%;">
							<select class="form-control" name="warranty" >
								<option value="3" >购买起计3年</option>
							</select>
						</div>
						<label class="control-label w100">墓穴维护期：</label>
						<div class="col-md-2">
							<select class="form-control" name="maintain" >
								<option value="20" >首位安葬起20年</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label ">抵顶人：</label>
						<div class="col-md-2">
							<select class="form-control" name="substitute" disabled>
								<option value="">无</option>
								<foreach name="didingList" item="vo">
									<if condition="isset($result['substitute'])">
										<option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
										<else/>
										<option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">类型：</label>
						<div class="col-md-2" style="width: 12%">
							<input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
							<select class="form-control"  disabled >
								<option value="1"  >商品墓</option>
							</select>
						</div>
						<label class="control-label w100">销售价格:</label>
						<div class="col-md-2" style="width: 21%;">
							<input type="text" class="form-control" value="{$result.selling_price|default=''}" name="selling_price" style="width:150px" disabled>
							<select class="form-control" name="menu_type" style="width:120px" disabled>
									<option value="套" >套</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label  ">匹配碑型：</label>
						<div class="col-md-3">
							<select id="mb_id" class="form-control"  disabled  name="new_pro" >
								<foreach name="mb_list" item="vo">
									<option value="{$vo.id}" <if condition="$vo.id eq $result['new_pro']">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
								</foreach>
							</select>
						</div>
						<label class="control-label">以旧换新：</label>
						<div class="col-md-2">
							<input type="hidden" id="tom_img" class="form-control" name="tom_img" value="{$result.tom_img|default=''}" >
							<select  class="form-control"  disabled  name="old_pro" >
								<foreach name="mb_list" item="vo">
									<option value="{$vo.id}" <if condition="$vo.id eq $result['old_pro']">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
								</foreach>
							</select>
						</div>
					</div>

				</fieldset>
				<!--<elseif condition="$cate_id eq 2" /> 艺术墓-->
				<fieldset>
					<div class="form-group" >
						<label class="control-label">左右长度：</label>
						<div class="col-md-2" style="width: 14%;">
							<input type="text" class="form-control" disabled  style="width:100px;" name="tombstone_h" value="{$result.tombstone_h|default=''}">mm
						</div>
						<label class="control-label">纵深宽度：</label>
							<div class="col-md-2" style="width: 14%;">
							<input type="text" class="form-control" style="width:100px;" disabled name="tombstone_w" value="{$result.tombstone_w|default=''}"> mm
						</div>
						<label class="control-label  " >占地面积：</label>
						<div class="col-md-2" style="width: 20%;">
							<input type="text" class="form-control" style="width:120px;" disabled  name="footprint" value="{$result.footprint|default=''}" >m²
							<input type="checkbox" name="is_bye" style="width: 20px;" value="1"  disabled  <if condition="'1' eq isset($result['is_bye'])?$result['is_bye']:0">checked</if> >含拜道
						</div>
						<label class="control-label" style="width: 100px">设计墓穴：</label>
						<div class="col-md-2">
							<select class="form-control" name="design" id="design" disabled>
                                <for start="0" end="6" step="1" >
                                    <if condition="isset($result['design'])">
                                        <option value="{$i}" <if condition="$i eq  $result['design']">selected </if>>{$i}套</option>
                                        <else/>
                                        <option value="{$i}">{$i}套</option>
                                    </if>
                                </for>
							</select>
						</div>
					</div>
					<div class="form-group" >
						<label class="control-label">最高限制高程：</label>
						<div class="col-md-2"  >
							<input type="text" class="form-control" disabled style="width:100px;" name="limit_height" value="{$result.limit_height|default=''}">mm
						</div>
						<label class="control-label " style="width: 90px">外围设置：</label>
						<div class="col-md-2"  >
							<select class="form-control" name="periphery" disabled>
								<foreach name="tomb_periphery" item="vo">
									<if condition="isset($result['periphery']) ">
										<option value="{$vo}" <if condition="$vo eq  $result['periphery'] ">selected </if>>{$vo}</option>
										<else />
										<option value="{$vo}" >{$vo}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label" style="width: 100px">售后质保期：</label>
						<div class="col-lg-2" style="width: 20%;">
							<select class="form-control" name="warranty" disabled >
								<option value="3" >购买起计3年</option>
							</select>
						</div>
						<label class="control-label" style="width: 100px">墓穴维护期：</label>
						<div class="col-md-2">
							<select class="form-control" name="maintain"  disabled>
								<option value="20" >首位安葬起20年</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label">抵顶人：</label>
						<div class="col-md-2">
							<select class="form-control" name="substitute" disabled>
								<option value="">无</option>
								<foreach name="didingList" item="vo">
									<if condition="isset($result['substitute'])">
										<option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
										<else/>
										<option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label" style="width: 100px">类型：</label>
						<div class="col-md-2">
							<input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
							<select class="form-control"  disabled >
								<option >艺术墓</option>
							</select>
						</div>
						<label class="control-label" style="width: 100px">销售价格:</label>
						<div class="col-md-2">
							<input type="text" disabled class="form-control" value="{$result.selling_price|default=''}" name="selling_price" style="width:80px">
							<select class="form-control" name="menu_type" disabled style="width:120px">
									<option value="平米" >平米</option>
							</select>
						</div>
						<label class="control-label">档案号：</label>
						<div class="col-md-2">
							<input type="hidden" class="form-control" name="order_id" value="{$order_id|default=''}" >
							<empty name="$archives_sn">
								<input type="text" class="form-control"   name="archives_sn" disabled value="{$archives_sn|default=''}" >
								<else/>
								<input type="text" class="form-control" name="archives_sn" disabled value="{$archives_sn|default=''}" >
							</empty>
						</div>
					</div>
				</fieldset>
				<!--<elseif condition="$cate_id eq 3" /> 生态墓-->
				<fieldset>
					<div class="form-group">
						<label class="control-label">壁式：</label>
						<div class="col-md-2">
							<select class="form-control" name="funeral" disabled>
								<foreach name="tomb_funeral.sp" item="vo">
									<if condition="isset($result['funeral'])">
										<option value="{$vo}" <if condition="$vo eq  $result['funeral'] ">selected </if>>{$vo}</option>
										<else />
										<option value="{$vo}" >{$vo}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">占地面积：</label>
						<div class="col-md-2">
							<input type="text" class="form-control" disabled name="footprint" value="{$result.footprint|default=''}" >m²
						</div>
						<label class="control-label w100">墓穴规制：</label>
						<div class="col-md-2">
							<select class="form-control" name="tomb_regulation"disabled >
								<foreach name="tomb_regulation" item="vo">
									<if condition="isset($result['tomb_regulation'])?$result['tomb_regulation']:0 ">
										<option value="{$vo.id}" <if condition="$vo.id eq  $result['tomb_regulation'] ">selected </if>>{$vo.name}</option>
										<else/>
										<option value="{$vo.id}"  >{$vo.name}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">收敛形式：</label>
						<div class="col-md-2">
							<select class="form-control" name="convergence" disabled>
								<foreach name="tomb_convergence.st" item="vo">
									<if condition="isset($result['convergence']) ">
										<option value="{$vo}" <if condition="$vo eq  $result['convergence'] ">selected </if>>{$vo}</option>
										<else />
										<option value="{$vo}" >{$vo}</option>
									</if>
								</foreach>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label">售后质保期：</label>
						<div class="col-md-2">
							<select class="form-control" name="warranty" disabled>
								<option value="1" >购买起计3年</option>
							</select>
						</div>
						<label class="control-label w100">墓穴维护期：</label>
						<div class="col-md-2">
							<select class="form-control" name="maintain" disabled>
								<option value="20" >首位安葬起20年</option>
							</select>
						</div>
						<label class="control-label w100">抵顶人：</label>
						<div class="col-md-2">
							<select class="form-control" name="substitute" disabled>
								<option value="">无</option>
								<foreach name="didingList" item="vo">
									<if condition="isset($result['substitute'])">
										<option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
										<else/>
										<option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">类型：</label>
						<div class="col-md-2">
							<input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
							<select class="form-control"  disabled >
								<option >生态墓</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label">销售价格:</label>
						<div class="col-md-2">
							<input type="text" class="form-control" disabled value="{$result.selling_price|default=''}" name="selling_price" style="width:80px">
							<input type="hidden" class="form-control" name="tom_img" value="{$result.tom_img|default=''}" >
							<select class="form-control" name="menu_type" style="width:120px" disabled>
									<option value="套" >套</option>
							</select>
						</div>
						<label class="control-label  ">匹配碑型：</label>
						<div class="col-md-3">
							<select id="mb_id" class="form-control"  disabled  name="new_pro" >
								<foreach name="mb_list" item="vo">
									<option value="{$vo.id}" <if condition="$vo.id eq $result['new_pro']">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
								</foreach>
							</select>
						</div>
						<label class="control-label">以旧换新：</label>
						<div class="col-md-2">
							<input type="hidden" id="tom_img" class="form-control" name="tom_img" value="{$result.tom_img|default=''}" >
							<select  class="form-control"  disabled  name="old_pro" >
								<foreach name="mb_list" item="vo">
									<option value="{$vo.id}" <if condition="$vo.id eq $result['old_pro']">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
								</foreach>
							</select>
						</div>
					</div>
				</fieldset>
				<!--<elseif condition="$cate_id eq 4" /> 节地目 （寄存，壁墓）-->
				<fieldset>
					<div class="form-group">
						<label class="control-label">壁式：</label>
						<div class="col-md-2">
							<select class="form-control" name="funeral" disabled >
								<foreach name="tomb_funeral.jd" item="vo">
									<if condition="isset($result['funeral'])">
										<option value="{$vo}" <if condition="$vo eq  $result['funeral'] ">selected </if>>{$vo}</option>
										<else />
										<option value="{$vo}" >{$vo}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">空间长度：</label>
						<div class="col-md-2">
							<input type="text" class="form-control" name="footprint" disabled style="width: 80%;" value="{$result.footprint|default=''}" >mm
						</div>
						<label class="control-label w100">空间宽度：</label>
						<div class="col-md-2">
							<input type="text" class="form-control" name="tombstone_w" disabled style="width: 80%;"value="{$result.tombstone_w|default=''}" >mm
						</div>
						<label class="control-label w100">空间高度：</label>
						<div class="col-md-2">
							<input type="text" class="form-control" name="tombstone_h" disabled style="width: 80%;"value="{$result.tombstone_h|default=''}" >mm
						</div>
					</div>
					<div class="form-group">
						<label class="control-label">所在层数：</label>
						<div class="col-md-2">
							<input type="text" class="form-control" name="layer_num" disabled value="{$result.layer_num|default=''}" >
						</div>
						<label class="control-label w100">墓穴规制{:isset($result.tomb_regulation)}：</label>
						<div class="col-md-2">
							<select class="form-control" name="tomb_regulation" disabled >
								<foreach name="tomb_regulation" item="vo">
									<if condition="isset($result['tomb_regulation'])">
										<option value="{$vo.id}" <if condition="$vo.id eq  $result['tomb_regulation'] ">selected </if>>{$vo.name}</option>
										<else/>
										<option value="{$vo.id}"  >{$vo.name}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">收敛形式：</label>
						<div class="col-md-2">
							<select class="form-control" name="convergence"  disabled>
								<foreach name="tomb_convergence_4" item="vo">
									<if condition="isset($result['convergence'])">
										<option value="{$vo.id}" <if condition="$vo.id eq  $result['convergence'] ">selected </if>>{$vo.name}</option>
										<else/>
										<option value="{$vo.id}"  >{$vo.name}</option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">售后质保期：</label>
						<div class="col-md-2">
							<select class="form-control" name="warranty" disabled >
								<option value="3" >购买起计3年</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label">墓穴维护期：</label>
						<div class="col-md-2">
							<select class="form-control" name="maintain" disabled >
								<option value="20" >首位安葬起20年</option>
							</select>
						</div>
						<label class="control-label w100">抵顶人：</label>
						<div class="col-md-2">
							<select class="form-control" name="substitute" disabled>
								<option value="">无</option>
								<foreach name="didingList" item="vo">
									<if condition="isset($result['substitute'])">
										<option value="{$vo.user_nickname}" <if condition="$vo.user_nickname eq  $result['substitute'] "> selected </if>>{$vo.user_nickname} </option>
										<else/>
										<option value="{$vo.user_nickname}">{$vo.user_nickname} </option>
									</if>
								</foreach>
							</select>
						</div>
						<label class="control-label w100">类型：</label>
						<div class="col-md-2">
							<input type="hidden" class="form-control" name="cate_id" value="{$info.cate_id}" >
							<select class="form-control"  disabled >
								<option >节地墓</option>
							</select>
						</div>
						<label class="control-label w100">销售价格：</label>
						<div class="col-md-2" style="width: 20%">
							<input type="text" class="form-control" value="{$result.selling_price|default=''}" name="selling_price" style="width:130px" disabled>
							<select class="form-control" name="menu_type" style="width:120px" disabled>
									<option value="套" >套</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label  ">匹配碑型：</label>
						<div class="col-md-3">
							<select id="mb_id" class="form-control"  disabled  name="new_pro" >
								<foreach name="mb_list" item="vo">
									<option value="{$vo.id}" <if condition="$vo.id eq $result['new_pro']">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
								</foreach>
							</select>
						</div>
						<label class="control-label">以旧换新：</label>
						<div class="col-md-2">
							<input type="hidden" id="tom_img" class="form-control" name="tom_img" value="{$result.tom_img|default=''}" >
							<select  class="form-control"  disabled  name="old_pro" >
								<foreach name="mb_list" item="vo">
									<option value="{$vo.id}" <if condition="$vo.id eq $result['old_pro']">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
								</foreach>
							</select>
						</div>
					</div>
				</fieldset>
				<!--</if>-->
			</div>
			<div class="col-md-2" style="padding: 0;;width: 13%;">
				<if condition="isset($result['tom_img'])">
					<img src="{:cmf_get_image_preview_url($result.tom_img)}" class="preview" id="preview_path" style="max-width:200px; display:block; margin:0 auto;"/>
					<eles />
					<img  class="preview" id="preview_path" style="max-width:200px; display:block; margin:0 auto;"/>
				</if>
			</div>
		</div>
		<fieldset>
			<div class="row" style="margin: 0;">
				<div class="p_title">
					<span class="span_title">墓碑信息</span>
				</div>
				<div class="col-lg-12 control-group1-p"  >

     	<!--<if condition="$cate_id eq 1 || $cate_id eq 3 || $cate_id eq 4">-->
					<div class="form-group">
						<label class="control-label w160">产品名称：</label>
						<div class="col-md-3">
							<select   class="form-control"  disabled  name="new_pro"  id="select_pro_id"  >
								<foreach name="mb_list" item="vo">
									<option value="{$vo.id}" <if condition="$vo.id eq $result['new_pro']">selected</if>>{$vo.pro_name}({$vo.pro_code})</option>
								</foreach>
							</select>
						</div>
						<label class="control-label">碑型：</label>
						<div class="col-md-2">
							<select class="form-control"  disabled  name="stele_type">
								<option value="1" <if condition="1 eq $result['stele_type']">selected</if>>立碑</option>
								<option value="2" <if condition="2 eq $result['stele_type']">selected</if>>卧碑</option>
								<option value="3" <if condition="3 eq $result['stele_type']">selected</if>>纪念墙</option>
								<option value="4" <if condition="4 eq $result['stele_type']">selected</if>>卧碑</option>
							</select>
						</div>
					</div>

					<!--<elseif condition="$cate_id eq 2" />  艺术墓-->
					<div class="form-group">
						<label class="control-label"  style="width: 150px">上传签章方案：</label>
						<div class="controls">
							<php>$img_urls=cmf_get_image_preview_url(isset($result['tom_img'])?$result['tom_img']:'');</php>
							<input type="hidden" name="upload_plan" id="thumb" value="{$result.tom_img|default=''}">
							<img src="{$img_urls}" id="thumb-preview" onclick="parent.imagePreviewDialog(this.src);"  width="36" style="cursor: hand"/>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label"  style="width: 150px">墓碑产品信息：</label>
						<div class="col-md-4">
							<select  class="form-control"   id="select_pro_id"  >
								<foreach name="$result.infoData" item="vo">
									<option value="{$vo.mb_id}"  data-mw_id="{$vo.tomb_id}"    data-key="{$key}" >【{$vo.mb_name}】位置: {$vo.address}</option>
								</foreach>
							</select>
						</div>
					</div>
					<!--</if>-->
					<div class="form-group proName"></div>
				</div>
			</div>

		</fieldset>
		<div class="form-actions">
			<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
		</div>

	</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script>

	var cate_id ="{$cate_id}";
	// $("#select_pro_id").trigger("onchange")
	$(function () {
		var id = "{$result['new_pro']}";
		if (cate_id==1){
			A(id)
		}else if (cate_id==2){
		   var upload_plan = $(this).attr('data-upload_plan');
		   if (upload_plan){
		       $('#photos_url-preview').attr('src',upload_plan).css('display','block');
           }
		   var pro_id = $("#select_pro_id").children('option:selected').val();
		   var mw_id = $("#select_pro_id").children('option:selected').data('mw_id');
			mb(pro_id,mw_id);
		}else if (cate_id==3){
			A(id)
		}else if (cate_id==4){
			A(id)
		}
	})
	$("#select_pro_id").change(function () {
		var mbid = $(this).val();
		if (cate_id==1){
			A(product_id)
		}else if (cate_id==2){
			mb(mbid);
		}else if (cate_id==3){
		}else if (cate_id==4){

		}
	})

	function mb(id,mwid=0){
		$.ajax({
			// url		: "{:url('getProductMbInfo')}",
			url		: "{:url('Visua/getProductInfo')}",
			type	: "get",
			dataType: "json",
			data	: {'id':id,'type': 2,mwid:mwid},
			success : function(result) {
				var html = getCommonHtml(result);
				console.log(html)
				$(".proName").html(html);


			},error	: function(){
				alert("服务器内部错误，请联系系统管理员");
			}
		});
	}
	// 墓碑详情
	$(".add_mub").click(function () {
		var pro_id = $(this).attr('data-pro_id');
		var pro_key = $(this).attr('data-key');
		var url = "{:url('productysmbView')}?id=" + pro_id + "&type=" + pro_key;
		layer.open({
			type: 2,     //包括但不限于一个值 ，具体 可以去查看  2  就是URL
			title: '查看墓碑详情',
			maxmin: true,
			shadeClose: true,       //我觉着应该再加个onclick shade 遮罩层  Close  关闭
			shade: 0.6,             //遮罩层 透明度
			area: ['95%', '75%'],
			content: url,            //这个和type  有关系，比如type = 1   content='这里可以直接写'

		});
	});


	function A(id){
		console.log(id)
		$.ajax({
			url		: "{:url('Visua/getProductInfo')}",
			type	: "get",
			dataType: "json",
			data	: {'id':id,'Ajax': 1},
			success : function(result){
				var html = getCommonHtml(result);
				console.log(html)
				$(".proName").html(html);
			},
			error	: function(){
				alert("服务器内部错误，请联系系统管理员");
			}
		});

	}
		var cate_type = {$cate_type};
		var getOptionHtml = function(icate){
			var html = "";
			$.each(cate_type, function(i, n){
				if(n.id == icate) {
					html += "<option value='"+n.id+"' selected>"+n.name+"</option>";
				}else{
					html += "<option value='"+n.id+"'>"+n.name+"</option>";
				}
			})
			return html;
		}
		var json = {$annexJson};
		 getAnnexHtml = function(annex){
			var html = "";
			$.each(json, function(i, n){
				if(n.id == annex) {
					html += "<option value='"+n.id+"' selected>"+n.name+"</option>";
				}else{
					html += "<option value='"+n.id+"'>"+n.name+"</option>";
				}
			})
			return html;
		}
		getCommonHtml = function(result){

			var pro_type = result.data.pro_type;
			if(result.infoData.length == 0){
				$("div[name='proName']").html('');
				$("input[name='change_name']").val("");
				$("input[name='old_pro']").val(0);
				return;
			}
			var change_name = result.data.name;
			if(change_name == null || change_name == ''){
				change_name = "无";
			}
			$("input[name='change_name']").val(change_name);
			$("input[name='old_pro']").val(result.data.change_id);
			var html="";
			html+=getYiShuOtherMaterialsHtml(result.infoData);

			if (pro_type!=3 && pro_type!=4) {
				html += "<div class='control-group1' style='width:100%'>"
						+ "<label class='control-label'>基础:</label>"
						+ "<div class='controls'>"
						+ "<select class='form-control' id='select_jichu' disabled>";
				if (result.data.pro_base == 1) {
					html += "<option value='1'>整石</option>";
				} else {
					html += "<option value='2'>贴面</option>";
				}
				html += "</select>"
						+ "</div>"
						+ "</div>";
			}
			// 基础
			html+=getYiShuOtherMaterialsHtml(result.baseData);
			// 盖板
			html+=getYiShuOtherMaterialsHtml(result.plateData);
			if (pro_type!=3 && pro_type !=4) {
				html += "<div class='control-group1' style='width:100%'>"
						+ "<label class='control-label'>有无栏杆:</label>"
						+ "<div class='controls'>"
						+ "<select class='form-control' disabled>";
				if (result.data.pro_railing == 1) {
					html += "<option value='1'>有</option>";
				} else {
					html += "<option value='2'>无</option>";
				}
				html += "</select>"
						+ "</div>"
						+ "</div>";

				html+=getYiShuOtherMaterialsHtml(result.railData);
			}

			if (pro_type!=3 ) {
				// 附件
				html += "<div class='control-group1' style='width:100%'>"
						+ "<label class='control-label'>有无附件:</label>"
						+ "<div class='controls'>"
						+ "<select class='form-control' disabled>";
				if (result.data.pro_annex == 1) {
					html += "<option value='1'>有</option>";
				} else {
					html += "<option value='2'>无</option>";
				}
				html += "</select>"
						+ "</div>"
						+ "</div>";
			}
			$.each(result.annexData, function(i, n){
				html += '<div class="form-group part_base" name="base">\n' +
						'      <div class="col-md-2" style="width: 24%;padding-right: 0;padding-left: 17px;" >\n' +
						'       <label class="control-label w160">选择附件：</label>\n' +
						'           <input type="hidden" name="annex['+i+'][id]" value="'+n.id+'">\n' +
						'       <div class=" ">\n' +
						'            <select class="form-control" >\n' +getAnnexHtml(n.annex_id)+'</select>\n'+
						'       </div>\n' +
						'   </div>\n' +
						'   <div class="col-md-2" >\n' +
						'       <label class="control-label inputw">数量：</label>\n' +
						'       <div class="col-md-2">\n' +
						'           <input type="text" class="form-control" style="width: 70px"  value="'+n.anumber+'">\n' +
						'       </div>\n' +
						'   </div>\n' +
						'   <div class="col-md-2" name="fujian" style=" width:50%">\n' +
						'   </div>\n' +
						'</div>';
			})
			html+=getYiShuOtherMaterialsHtml(result.othData)
			return html;
		}

		getYiShuOtherMaterialsHtml = function(result){
			var html = "";
			$.each(result,function (i,n) {
				html+='<div class="form-group part_base" name="base">\n' +
						'       <div class="col-md-2" style="width: 27%;padding-right: 0;padding-left: 17px;">\n' +
						'           <label class="control-label w160" >'+n.iname+'：</label>\n' +
						'           <input type="text" class="form-control minwidth iwidth" disabled value="'+n.iwidth+'">\n' +
						'           <input type="text" class="form-control minwidth iheight"disabled value="'+n.iheight+'">\n' +
						'           <input type="text" class="form-control minwidth ithick" disabled value="'+n.ithick+'"> mm\n' +
						'       </div>\n' +
						'       <div class="col-md-2" style="width: 17%">\n' +
						'           <label class="control-label inputw">材料种类：</label>\n' +
						'           <div class="col-md-4">\n' +
						'               <select class="form-control icate" disabled>\n' +getOptionHtml(n.icate)+ '</select>\n' +
						'           </div>\n' +
						'       </div>\n' +
						'       <div class="col-md-2" style="width:12%">\n' +
						'           <label class="control-label w70">数量：</label>\n' +
						'           <div class="col-md-4">\n' +
						'               <input type="text" class="form-control inumber" disabled style="width:100px;"  value="'+n.inumber+'">\n' +
						'           </div>\n' +
						'       </div>\n' +
						'       <div class="col-md-2" style="width:13%">\n' +
						'           <label class="control-label w100">材料价格：</label>\n' +
						'           <div class="col-md-4">\n' +
						'               <input type="text" class="form-control imaterial_price" disabled style="width:100px;" value="'+n.imaterial_price+'">\n' +
						'           </div>\n' +
						'       </div>\n' +
						'       <div class="col-md-2" style="width:13%">\n' +
						'           <label class="control-label w100">维修单价：</label>\n' +
						'           <div class="col-md-4">\n' +
						'               <input type="text" class="form-control irepair_price" disabled style="width:100px;" value="'+n.irepair_price+'">\n' +
						'           </div>\n' +
						'       </div>\n' +
						'       <div class="col-md-2" style="width:12%">\n' +
						'           <label class="control-label w100">更换单价：</label>\n' +
						'           <div class="col-md-4">\n' +
						'               <input type="text" class="form-control ichange_price" disabled style="width:100px;" value="'+n.ichange_price+'">\n' +
						'           </div>\n' +
						'       </div>\n' +
						'   </div>';
			})
           return html;
		}
</script>
